package com.rpay.dao.feedback;

import com.rpay.model.feedback.FeedbackDO;
import com.rpay.model.feedback.FeedbackQueryDO;
import org.mybatis.spring.SqlSessionTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Repository;
import java.util.List;

@Repository
public class FeedbackDao {
    @Autowired
    @Qualifier("readSqlSession")
    private SqlSessionTemplate readSqlSession;

    @Autowired
    @Qualifier("writeSqlSession")
    private SqlSessionTemplate writeSqlSession;

    public List<FeedbackDO> list(FeedbackQueryDO feedbackQueryDO){
        return readSqlSession.selectList("rpay.feedback.list",feedbackQueryDO);
    }
    public Integer selectRow(FeedbackQueryDO feedbackQueryDO) {
        return readSqlSession.selectOne("rpay.feedback.selectRow", feedbackQueryDO);
    }
    public int delete(Integer id){
        return writeSqlSession.update("rpay.feedback.delete",id);
    }
    public int insert(FeedbackDO feedbackDO) {
        return writeSqlSession.insert("rpay.feedback.insert", feedbackDO);
    }

    public int patch(FeedbackDO feedbackDO) {
        return writeSqlSession.update("rpay.feedback.patch", feedbackDO);
    }
}
